﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Blog190210.Models.DBModels;
using System.Data.SqlClient;

namespace Blog190210.Models.DAL
{
    /// <summary>
    /// 用户
    /// </summary>
    public class UserSer
    {
        public User GetUserByName(string userName) {
            User user =null;
            string strSql =string.Format( "select *from [User] where UserName='{0}'",userName);
            SqlDataReader dr= DBHelper.ExecuteReader(strSql);
            if (dr.Read()) {
                user = new User() {
                    UserName = dr["UserName"].ToString(),
                    Password = dr["Password"].ToString(),
                    SelfSlogo = dr["SelfSlogo"].ToString(),
                    SelfPhoto = dr["SelfPhoto"].ToString(),
                    LastLoginTime = dr["LastLoginTime"].ToString(),
                    AboutMe = dr["AboutMe"].ToString()                
                };
            }
            return user;
        }
    }
}